class PaginatedTransactionModel {
  int? totalSize;
  String? limit;
  String? offset;
  List<TransactionModel>? data;

  PaginatedTransactionModel(
      {this.totalSize, this.limit, this.offset, this.data});

  PaginatedTransactionModel.fromJson(Map<String, dynamic> json) {
    totalSize = json['total_size'];
    limit = json['limit'].toString();
    offset = json['offset'].toString();
    if (json['transactions'] != null) {
      data = [];
      json['transactions'].forEach((v) {
        data!.add(new TransactionModel.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['total_size'] = this.totalSize;
    data['limit'] = this.limit;
    data['offset'] = this.offset;
    if (this.data != null) {
      data['transactions'] = this.data!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class TransactionModel {
  double? balance;
  double? credit;
  double? debit;
  String? transactionId;
  String? transactionType;
  String? createdAt;
  String? updatedAt;

  TransactionModel({this.credit, this.debit, this.balance});

  TransactionModel.fromJson(Map<String, dynamic> json) {
    balance = json['balance'].toDouble() ?? 0.00;
    credit = json['credit'].toDouble() ?? 0.00;
    debit = json['debit'].toDouble() ?? 0.00;
    transactionId = json['transaction_id'];
    transactionType = json['transaction_type'];
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
  }
  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['balance'] = this.balance;
    data['credit'] = this.credit;
    data['debit'] = this.debit;
    data['transaction_id'] = this.transactionId;
    data['transaction_type'] = this.transactionType;
    return data;
  }
}
